<?php
/**
* @author Bimal Poudel
* @copyright since 2006, Bimal Poudel
* @package Smarty Framework
* @support http://www.odesk.com/users/~~dd91d11caed0cdce
* @contact http://www.sanjaal.com
* @company Sanjaal Corps
*/

# Created on: 2011-03-26 02:03:16 265

/**
* Lists entities in users
*/

# When a user will cancel add/edit forms, we will try to come back here
url::remember();

# Begin the paginator along with: users
# Parameter: GET[], and per page
$pagination = new pagination('pg', __PER_PAGE__);

$users = new users();

# Be sure NOT to load too many entiries. Save the database
# Please modify this code, particularly for:
#	Page Limits
#	Selection Conditions
$search = $variable->post('search-query', 'string', '');
$search_query = $variable->remember_string('search-query');
$smarty->assign('search_query', $search_query);

$condition = new condition();

# Listed records that are bound to the current subdomain only
# $subdomain_id = framework::subdomain_id();

$condition->add('FULL', array(
	#"e.subdomain_id={$subdomain_id}", # Bind the records
	"e.is_active='Y'", # Do not remove this
));

# Compulsory conditons
$condition->add('AND', array(
	#'e.search_field' => 'Y', # Partial %contents%
));

# List out the entries
$entries = $users->list_entries(
	$condition,
	$from_index=$pagination->begining_entry(),
	$pagination->per_page()
);

# Pagination helper
$pagination->set_total($users->total_entries());
$smarty->assignByRef('pagination', $pagination);

# Assign to Smarty: Lists
$smarty->assignByRef('userss', $entries);
?>